<div class="span12">
    <?php echo $this->Session->flash('platos'); ?>
</div>
<?php
echo $this->element('headerPageTitle', array("titlePage" => "Platos", "subTitlePage" => ""));
?>
<div id="page">
<p><?php echo $this->Html->link('Añadir plato', array('action' => 'add'),array('class' => 'button')); ?></p>

			<div id="container">
			<div id="gallery" class="content">
					<div id="controls" class="controls"></div>
					<div class="slideshow-container">
						<div id="loading" class="loader"></div>
						<div id="slideshow" class="slideshow"></div>
						<div id="caption" class="caption-container"></div>
					</div>
				
				</div>
				<div id="thumbs" class="navigation">
					<ul class="thumbs noscript">
						 <?php foreach ($productos as $producto): ?>
	

						<li>
							<a class="thumb" href="<?php echo $producto['Producto']['img']?>" title=" <?php echo $producto['Producto']['nombre']?>">
								<img width="75px" height="75px" src="<?php echo $producto['Producto']['urlThumb']?>" alt=" <?php echo $producto['Producto']['desc']?>" />
							</a>
							
							<div class="caption">
								 <div class="image-title">Nombre: <?php echo $producto['Producto']['nombre']?></div>
								 <div class="image-desc">Descripción: <?php echo $producto['Producto']['desc']?></div>
                <?php echo $this->Html->link("Editar", array('action' => 'edit', $producto['Producto']['id'] ));?>          
            <?php echo $this->Form->postLink(
                'Borrar',
                array('action' => 'delete', $producto['Producto']['id']),
                array('confirm' => 'Se va a borrar el plato. ¿Desea continuar?'));
            ?>
            <div class="download">
                    <a href="<?php echo $producto['Producto']['img']?>">Descargar</a>
                  </div>
              </div>
							
							
							
						</li><?php endforeach; ?>

					</ul>
				</div>
				<!-- End Advanced Gallery Html Containers -->

				<!-- Add image link -->				
			

			</div></div>

		
		<script type="text/javascript">
			jQuery(document).ready(function($) {
				// We only want these styles applied when javascript is enabled
				$('div.navigation').css({'width' : '300px', 'float' : 'left'});
				$('div.content').css('display', 'block');

				// Initially set opacity on thumbs and add
				// additional styling for hover effect on thumbs
				var onMouseOutOpacity = 0.67;
				$('#thumbs ul.thumbs li').opacityrollover({
					mouseOutOpacity:   onMouseOutOpacity,
					mouseOverOpacity:  1.0,
					fadeSpeed:         'fast',
					exemptionSelector: '.selected'
				});

				// Enable toggling of the caption
				var captionOpacity = 0.8;
				
				
				// Initialize Advanced Galleriffic Gallery
				var gallery = $('#thumbs').galleriffic({
					delay:                     2500,
					numThumbs:                 10,
					preloadAhead:              10,
					enableTopPager:            true,
					enableBottomPager:         true,
					maxPagesToShow:            100,
					imageContainerSel:         '#slideshow',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					renderSSControls:          true,
					renderNavControls:         true,
					playLinkText:              'Play',
					pauseLinkText:             'Pause',
					prevLinkText:              '&lsaquo;Anterior',
					nextLinkText:              'Siguiente&rsaquo;',
					nextPageLinkText:          '&rsaquo;',
					prevPageLinkText:          '&lsaquo;',
					enableHistory:             false,
					autoStart:                 false,
					syncTransitions:           true,
					defaultTransitionDuration: 900,
					onSlideChange:             function(prevIndex, nextIndex) {
						// 'this' refers to the gallery, which is an extension of $('#thumbs')
						this.find('ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onTransitionOut:           function(slide, caption, isSync, callback) {
						slide.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0, callback);
						caption.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0);
					},
					onTransitionIn:            function(slide, caption, isSync) {
						var duration = this.getDefaultTransitionDuration(isSync);
						slide.fadeTo(duration, 1.0);
						
						// Position the caption at the bottom of the image and set its opacity
						var slideImage = slide.find('img');
						caption.width(slideImage.width())
							.css({
								'bottom' : Math.floor((slide.height() - slideImage.outerHeight()) / 2),
								'left' : Math.floor((slide.width() - slideImage.width()) / 2) + slideImage.outerWidth() - slideImage.width()
							})
							.fadeTo(duration, captionOpacity);
					},
					onPageTransitionOut:       function(callback) {
						this.fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
						this.fadeTo('fast', 1.0);
					},
					onImageAdded:              function(imageData, $li) {
						$li.opacityrollover({
							mouseOutOpacity:   onMouseOutOpacity,
							mouseOverOpacity:  1.0,
							fadeSpeed:         'fast',
							exemptionSelector: '.selected'
						});
					}
				});

				
				
				/****************************************************************************************/
			});
		</script>